package com.wondream.java.io.example;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import java.io.File;
import java.io.FileOutputStream;
import java.text.SimpleDateFormat;
import java.util.Date;

public class FileOutputStreamTest {

    private final Log logger = LogFactory.getLog(FileOutputStreamTest.class);

    public static void main(String[] args) {

        File file = null;

        FileOutputStream fileOutputStream = null;

        try {
            StringBuilder pathname = new StringBuilder("./logs/");
            SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
            pathname.append(formatter.format(new Date())).append(".log");
            file = new File(pathname.toString());
            fileOutputStream = new FileOutputStream(file, true);

            String var1 = " 是兄弟就来砍我！";
            fileOutputStream.write(var1.getBytes("UTF-8"));
            fileOutputStream.close();
        }catch (Exception e){

        }
    }
}
